package com.zhazha.earlybird;


import android.app.Activity;
import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore.Audio;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class NotifacationAlarmActivity extends Activity{
	
	    
	    public static final int NOTIFICATION_ID=1;   
	      
	    @Override  
	    protected void onCreate(Bundle savedInstanceState) {  
	         super.onCreate(savedInstanceState); 
	         
	        setContentView(R.layout.alarmremind);  
	        
	        TextView title_tv=(TextView)findViewById(R.id.alarmremind_textview_title);
	 	    TextView time_tv=(TextView)findViewById(R.id.alarmremind_textview_time);
	 	    TextView place_tv=(TextView)findViewById(R.id.alarmremind_textview_place);
	        Button ok_btn=(Button)findViewById(R.id.alarmremind_btn_ok);
	        
	 	    Bundle extras=getIntent().getExtras();
	    	 int count=0;
	    	 String time;
	    	 String place;
	    	 String title;
	 	     if(extras!=null)
	 	     {
	 	    	 count=extras.getInt("count");
	 	    	 time=extras.getString("time");
	 	    	 title=extras.getString("title");
	 	    	 place=extras.getString("place");
	 	    	 
	 	    	title_tv.setText(title);
		 	    time_tv.setText(time);
		 	    place_tv.setText(place);
	 	    	 
	 	     }
	 	   
	 	    
	 	    
	 	     //Toast.makeText(this, count+"", Toast.LENGTH_SHORT).show();
	 	     
	        // create the instance of NotificationManager  
	        final NotificationManager nm=(NotificationManager) getSystemService(NOTIFICATION_SERVICE);  
	        // create the instance of Notification  
	        Notification n=new Notification();  
	        /* set the sound of the alarm. There are two way of setting the sound */  
	          // n.sound=Uri.parse("file:///sdcard/alarm.mp3");  
	        n.sound=Uri.withAppendedPath(Audio.Media.INTERNAL_CONTENT_URI, "20");  
	        // Post a notification to be shown in the status bar  
	        nm.notify(NOTIFICATION_ID, n);  
	       
	      
	        /* display some information */  
	       // TextView tv=(TextView)findViewById(R.id.tvNotification);  
	        //tv.setText("Hello, it's time to bla bla...");  
	          
	        /* the button by which you can cancel the alarm */  
	        //Button btnCancel=(Button)findViewById(R.id.btnCancel);  
	        ok_btn.setOnClickListener(new View.OnClickListener() {  
	              
	         
	            public void onClick(View arg0) {  
	                nm.cancel(NOTIFICATION_ID);  
	                finish();  
	            }  
	        }); 
	    }  

}

